package com.ahstu.learning.learning;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.ahstu.learning.R;


public class PageFragment extends Fragment {
	ImageView adimageview;
    private int picId;
    //Subject sum;

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {

		adimageview.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				switch (picId) {
					case R.drawable.banner01:
						startActivity(new Intent(getActivity(), Learning_Web.class));
						break;
					case R.drawable.banner02:
						startActivity(new Intent(getActivity(), LearningDagang.class));
						break;
					case R.drawable.banner03:
                        Intent intent = new Intent(getActivity(), Course_list.class);
                        intent.putExtra("subject", "Chymist");
                        startActivity(intent);
                        break;
					default:
						break;
				}
			}
		});
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
							 Bundle savedInstanceState) {
		View inflate = inflater.inflate(R.layout.friend_scroll_fragment, null);
		adimageview = (ImageView) inflate.findViewById(R.id.adimageview);
		adimageview.setBackgroundResource(picId);
		return inflate;
	}

	public void setPagePicture(int picId) {
		this.picId = picId;
	}
}
